-- MoonSaberTagger.lua

function MoonSaberTagger_Update(...)

    local frame_unit = this.unit
    if frame_unit == nil then
      return
    end
    local unit_name = GetUnitName(frame_unit)

    local name_text = unit_name
    if UnitIsEnemy("player", frame_unit) then
        
        if UnitIsPlayer(frame_unit) then
	    local player_class, english_class = UnitClass(frame_unit)
	    name_text = format("%s/%s", english_class, name_text)
        else
	    --name_text = format("MOB %s", name_text)
        end
    else
        --name_text = format("FRIENDLY %s", name_text)
    end 

    if unit_name ~= name_text then
      this.name:SetText(name_text)
    end
end

hooksecurefunc('UnitFrame_Update', MoonSaberTagger_Update)
